<?php

class FacilityDetails extends CActiveRecord
{
  /*
   * id 
   * gTypeId 物品类型
   * geometry  3D模型js文件的路径
   * name  家具物品的名称
   * description 对家具物品的描述
   * thumbPath 缩略图的路径
   * dependId  "物品可摆放的位置。地面，桌面，墙面，全部"
   * inputDate 物品添加时间
   */
   
    /**
   * Returns the static model of the specified AR class.
   * @return CActiveRecord the static model class
   */
  public static function model($className=__CLASS__)
  {
    return parent::model($className);
  }

  /**
   * @return string the associated database table name
   */
  public function tableName()
  {
    return 'Facility_Details';
  }
  
  public function relation(){
    return array('type'=>array(self::BELONGS_TO,'Facility_types','id'),
                'FacilityRoom'=>array(self::HAS_MANY, 'FacilityRoom', 'fd_id','together'=>false));
  }  
  
  public function primaryKey(){
    return 'id';
  }
  
  public function getAllFetchPage($currentPageNo,$recordsPerPage){
    // $offset=($currentPageNo - 1) * $recordsPerPage;
    // $criteria = new EMongoCriteria;
    // $criteria->limit($recordsPerPage)->offset($offset);

    $record= self::model()->findAll('usable=:usable',array(':usable'=>1));
    return $record;
  }
}
?>
  